//
//  BKMyorderApplyReturnGoodsCell.m
//  bestkeep
//
//  Created by Mr. Wu on 16/12/20.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKMyorderApplyReturnGoodsCell.h"
#import "BK_OD_Tool.h"
@implementation BKMyorderApplyReturnGoodsCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _i = 1;
        
        self.backgroundColor = [UIColor whiteColor];
        
        _classifyLabel = [UILabel new];
        _classifyLabel.font = [UIFont systemFontOfSize:14.0];
        _classifyLabel.textColor = [UIColor grayColor];
        _classifyLabel.text = @"申请类型";
        _classifyLabel.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_classifyLabel];
        
        [_classifyLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.contentView.mas_top).offset(5);
            make.left.mas_equalTo(self.contentView.mas_left).offset(ApplicationBackGauge);
        }];
        
        _lostBtn = [UIButton new];
        [_lostBtn setTitle:@"退货" forState:UIControlStateNormal];
        [_lostBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        //   [_lostBtn setTitleColor:RGB(27, 188, 155) forState:UIControlStateNormal];
        
        [_lostBtn.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
        _lostBtn.layer.borderColor = [UIColor grayColor].CGColor;
        _lostBtn.layer.borderWidth = 0.5;
        _lostBtn.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_lostBtn];
        
        [_lostBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_classifyLabel.mas_bottom).offset(10);
            make.left.mas_equalTo(self.contentView.mas_left).offset(ApplicationBackGauge);
            make.width.mas_equalTo(@(72));//50->72
            make.height.mas_equalTo(@(30));
        }];
        
        _changeBtn = [UIButton new];
        [_changeBtn setTitle:@"换货" forState:UIControlStateNormal];
        [_changeBtn.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
        [_changeBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        //        [_changeBtn setTitleColor:RGB(27, 188, 155) forState:UIControlStateSelected];
        _changeBtn.layer.borderColor = [UIColor grayColor].CGColor;
        _changeBtn.layer.borderWidth = 0.5;
        _changeBtn.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_changeBtn];
        
        [_changeBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_lostBtn.mas_top).offset(0);
            make.left.mas_equalTo(_lostBtn.mas_right).offset(20);
            make.width.mas_equalTo(@(72));
            make.height.mas_equalTo(@(30));
        }];
        
        _dataLabel = [UILabel new];
        _dataLabel.textColor = RGB(102, 102, 102);//blackColor
        _dataLabel.text = @"申请数量";
        _dataLabel.backgroundColor = [UIColor whiteColor];
        _dataLabel.font = [UIFont systemFontOfSize:14.0];
        [self.contentView addSubview:_dataLabel];
        
        [_dataLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_lostBtn.mas_bottom).offset(10);
            make.left.mas_equalTo(self.contentView.mas_left).offset(ApplicationBackGauge);
        }];
        
        _reduceBtn = [UIButton new];
        [_reduceBtn setTitle:@"-" forState:UIControlStateNormal];
        [_reduceBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_reduceBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0]];
        _reduceBtn.layer.borderColor = [UIColor grayColor].CGColor;
        _reduceBtn.layer.borderWidth = 0.5;
        [self.contentView addSubview:_reduceBtn];
        
        [_reduceBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_dataLabel.mas_bottom).offset(10);
            make.left.mas_equalTo(self.contentView.mas_left).offset(ApplicationBackGauge);
            make.width.mas_equalTo(@(35));
            make.height.mas_equalTo(@(35));
        }];
        
        _goodsDataLabel = [UILabel new];
        _goodsDataLabel.backgroundColor = [UIColor whiteColor];
        _goodsDataLabel.layer.borderColor = [UIColor grayColor].CGColor;
        _goodsDataLabel.layer.borderWidth = 0.5;
        _goodsDataLabel.text = @"1";
        _goodsDataLabel.font = [UIFont systemFontOfSize:14.0];
        _goodsDataLabel.textAlignment = NSTextAlignmentCenter;
        _goodsDataLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:_goodsDataLabel];
        
        [_goodsDataLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_reduceBtn.mas_top).offset(0);
            make.left.mas_equalTo(_reduceBtn.mas_right).offset(0);
            make.width.mas_equalTo(@(45));
            make.height.mas_equalTo(@(35));
        }];
        
        _addBtn = [UIButton new];
        [_addBtn setTitle:@"+" forState:UIControlStateNormal];
        [_addBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_addBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0]];
        _addBtn.layer.borderColor = [UIColor grayColor].CGColor;
        _addBtn.layer.borderWidth = 0.5;
        [self.contentView addSubview:_addBtn];
        
        [_addBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_reduceBtn.mas_top).offset(0);
            make.left.mas_equalTo(_goodsDataLabel.mas_right).offset(0);
            make.width.mas_equalTo(@(35));
            make.height.mas_equalTo(@(35));
        }];
        
        //        _noticeLabel = [UILabel new];
        //        _noticeLabel.textColor = [UIColor grayColor];
        //        _noticeLabel.font = [UIFont systemFontOfSize:11.0];//9->11
        ////        _noticeLabel.text = @"您最多可提交数量为2个";
        //        _noticeLabel.text = [NSString stringWithFormat:@"您最多可提交数量为%@个",_orderModel.goodsAmount];
        //        [self.contentView addSubview:_noticeLabel];
        //
        //        [_noticeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        //            make.top.mas_equalTo(_reduceBtn.mas_bottom).offset(10);
        //            make.left.mas_equalTo(self.contentView.mas_left).offset(10);
        //        }];
    }
    return self;
}
-(void)setOrdermodel:(BK_My_Order_rows_itemList_Model *)ordermodel{
    _noticeLabel = [UILabel new];
    _noticeLabel.textColor = [UIColor grayColor];
    _noticeLabel.font = [UIFont systemFontOfSize:11.0];
    _noticeLabel.text = [NSString stringWithFormat:@"您最多可提交数量为%@个",ordermodel.amount];
    [self.contentView addSubview:_noticeLabel];
    
    [_noticeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_reduceBtn.mas_bottom).offset(10);
        make.left.mas_equalTo(self.contentView.mas_left).offset(ApplicationBackGauge);
    }];
}
    
    
    
@end
